/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package manager;

import database.BookDB;
import database.CategoryDB;
import database.Connection;
import database.DepartmentDB;
import database.EmployeeDB;
import database.OrdersDB;
import database.OrdersDetailsDB;

/**
 *
 * @author Noi
 */

public class Manager {
    
    public Manager() {
        this.conn = new Connection();
        
        this.initManagerDB();
    }
    
    public final void initManagerDB() {
        this.departmentDB = new DepartmentDB(this.conn.getConn());
        this.employeeDB = new EmployeeDB(this.conn);
        this.categoryDB = new CategoryDB(this.conn.getConn());
        this.bookDB = new BookDB(this.conn.getConn());
        this.ordersDB = new OrdersDB(this.conn.getConn());
        this.ordersDetailsDB = new OrdersDetailsDB(this.conn.getConn());
    }
    
    public void loadDataToOrdersManager() {
        this.ordersManager = new OrdersManager(this);
        this.ordersDB.loadData(ordersManager, true);
    }
    
    public void loadDataToOrdersDetailsManager() {
        this.ordersDetailsManager = new OrdersDetailsManager(this);
        this.ordersDetailsDB.loadData(ordersDetailsManager, true);
    }
    
    public void loadDataToBookManager() {
        this.bookManager = new BookManager(this);
        this.bookDB.loadData(bookManager, true);
    }
    
    public void loadDataToDepartmentManager() {
        this.departmentManager = new DepartmentManager(this);
        this.departmentDB.loadData(departmentManager, true);
    }
    
    public void loadDataToEmployeeManager() {
        this.employeeManager = new EmployeeManager(this);
        this.employeeDB.loadData(employeeManager, true);
    }
    
    public void loadDataToCategoryManager() {
        this.categoryManager = new CategoryManager(this);
        this.categoryDB.loadData(categoryManager, true);
    }
    
    public BookManager getBookManager() {
        return this.bookManager;
    }
    
    public DisabledBookManager getDisabledBookManager() {
        throw new UnsupportedOperationException("Not yet implemented");
    }
    
    public DisabledCategoryManager getDisabledCategoryManager() {
        throw new UnsupportedOperationException("Not yet implemented");
    }

    public DisabledDepartmentManager getDisabledDepartmentManager() {
        throw new UnsupportedOperationException("Not yet implemented");
    }

    public DisabledEmployeeManager getDisabledEmployeeManager() {
        throw new UnsupportedOperationException("Not yet implemented");
    }

    public DisabledOrdersDetailsManager getDisabledOrdersDetailsManager() {
        return this.disabledOrdersDetailsManager;
    }

    public DisabledOrdersManager getDisabledOrdersManager() {
        throw new UnsupportedOperationException("Not yet implemented");
    }

    public DisabledPublisherManager getDisabledPublisherManager() {
        throw new UnsupportedOperationException("Not yet implemented");
    }

    public DisabledUserManager getDisabledUserManager() {
        throw new UnsupportedOperationException("Not yet implemented");
    }

    public CategoryManager getCategoryManager() {
        return this.categoryManager;
    }

    public DepartmentManager getDepartmentManager() {
        return this.departmentManager ;
    }

    public EmployeeManager getEmployeeManager() {
        return this.employeeManager;
    }

    public OrdersDetailsManager getOrdersDetailsManager() {
        return this.ordersDetailsManager;
    }

    public OrdersManager getOrdersManager() {
        return this.ordersManager;
    }

    public OrdersDB getOrdersDB() {
        return ordersDB;
    }

    public OrdersDetailsDB getOrdersDetailsDB() {
        return ordersDetailsDB;
    }

    public UserManager getUserManager() {
        throw new UnsupportedOperationException("Not yet implemented");
    }
    
    public java.sql.Connection getConnection() {
        return this.conn.getConn();
    }
    
    private OrdersManager ordersManager;
    private OrdersDB ordersDB;
    private OrdersDetailsManager ordersDetailsManager;
    private OrdersDetailsDB ordersDetailsDB;
    private BookManager bookManager;
    private BookDB bookDB;
    private CategoryManager categoryManager;
    private CategoryDB categoryDB;
    private DepartmentDB departmentDB;
    private DepartmentManager departmentManager;
    private EmployeeDB employeeDB;
    private EmployeeManager employeeManager;
    private Connection conn;
    private DisabledBookManager disabledBookManager;
    private DisabledOrdersManager disabledOrdersManager;
    private DisabledOrdersDetailsManager disabledOrdersDetailsManager;

    public BookDB getBookDB() {
        return this.bookDB;
    }
}
